﻿using B.S.Medical.Api.Read.Application.Command.Register;
using B.S.Medical.Api.Read.DTOS;
using B.S.Medical.Api.Read.DTOS.Fee;
using B.S.Medical.Domain.Doctor;
using B.S.Medical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Medical.Api.Read.Controllers
{
    /// <summary>
    /// 挂号控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RegisterController : ControllerBase
    {
        private readonly IMediator mediator;

        public RegisterController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 查询预约信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPageing<RegisterDto>> ShowRegister([FromQuery]ShowRegisterCommand request)
        {
             return await mediator.Send(request);
        }

        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<RegisterDetailDto>> ShowRegisterDetail(int id)
        {
            var common = new ShowRegisterDetailCommand();
            common.Id = id;
            return await mediator.Send(common);
        }
        /// <summary>
        /// 预约须知查询实现方法
        /// </summary>
        /// <returns>返回同意包装类</returns>
        [HttpGet]
        public async Task<ApiResult<AppointmentNoticeModel>> AppointmentNoticeGet([FromQuery]AppointmentNoticeCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 挂号费用详情查询
        /// </summary>
        /// <param name="registerId"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<RegisterFeeDetailDto> GetRegisterFeeDetail(int registerId)
        {
            return await mediator.Send(new ShowRegisterFeeDetailCommand(registerId));
        }
    }
}
